<?php 
class invoicetax{
	public $taxlevel=0.1;
	public $orderid='';
	public $ordertime='';
	public $ormonth='';
	public $orday='';
	public $oryear='';
	public $order_content='';
	public $order_suplly_rice=0;
	public $order_tax=0;
	public $order_total=0;
	public $order_time_transaction='';
	public $orusercreate='';
	public $ordatecreate='';
	public $orstatus=0;
	public $order_quantity=1;
	public $order_cus='';
	public $cusname='';
	
	
	function setCusname($name){
		$this->cusname=$name;
	}
	
	function Instance($id,$ortime,$ormon,$orday,$oryear,$cus,$oritem,$orsl,$orgia,$ortax,$ortotal,$ortrantime,$orstatus,$orus,$ordatecreate){
		$this->orderid=$id;
		$this->ordertime=$ortime;
		$this->ormonth=$ormon;
		$this->orday=$orday;
		$this->oryear=$oryear;
		$this->order_cus=$cus;
		$this->order_content=$oritem;
		$this->order_suplly_rice=$orgia;
		$this->order_tax=round($ortax);
		$this->order_total=$ortotal;
		if($ortrantime=='0000-00-00')
			$this->order_time_transaction="";
		else 
			$this->order_time_transaction=$ortrantime;
		$this->order_quantity=$orsl;
		$this->orusercreate=$orus;
		$this->ordatecreate=$ordatecreate;
		$this->orstatus=$orstatus;
		$this->taxlevel=0.1;
	}
	
	function newinvoicetax(){
		$this->taxlevel=0.1;
		$this->orderid='';
		$this->ordertime='';
		$this->ormonth='';
		$this->orday='';
		$this->oryear='';
		$this->order_content='';
		$this->order_suplly_rice=0;
		$this->order_tax=0;
		$this->order_total=0;
		$this->order_time_transaction='';
		$this->order_quantity=1;
		$this->orusercreate='';
		$this->ordatecreate='';
		$this->orstatus=0;
		$this->cusname='';
	}
	
	/*function tinhthue(){
		$this->order_tax=$this->order_suplly_rice * ($this->taxlevel + 1);
	}
	
	function tinhtien(){
		$this->order_total=$this->order_quantity *  $this->order_tax;
	}*/
	
	function tinhthue(){
		$this->order_tax=round($this->order_suplly_rice * $this->taxlevel);
		//$this->order_tax=$this->order_suplly_rice * 0.1;
	}
	
	function tinhgia(){
		//$this->order_suplly_rice=$this->order_tax * 10;
		//$this->order_suplly_rice=$this->order_tax / 0.1;
	}
	
	function tinhtien(){
		if($this->order_suplly_rice>=0)
			$this->order_total=($this->order_quantity * abs($this->order_tax + $this->order_suplly_rice));
		else
			$this->order_total=-($this->order_quantity * abs($this->order_tax + $this->order_suplly_rice));
	}
}
?>